home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 February: Tool Chest / Dev.CD Feb 99 TC.toast / What's New? / Development Kits / Mac OS USB v1.1f3 DDK / Examples / PrinterClassDriver / Chooser.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-07  |  2.5 KB  |  78 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Chooser.h
  3.  
  4.     Contains:    Header file for Chooser PACK code to support USB and serial printers
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11. #ifndef __Chooser__
  12. #define __Chooser__
  13. #define    kUSBModelPathString        1000
  14. #define    kUSBPrinterPathString    2000
  15. #define    kPrinterNameString        2100
  16.  
  17. #ifndef __TYPES__
  18. #include <Types.h>
  19. #endif
  20.  
  21. #include <CodeFragments.h>
  22.  
  23. typedef struct
  24. {
  25. // address of name registry routines
  26.     ProcPtr        RegistryEntryIDInitAddr;
  27.     ProcPtr        RegistryCStrEntryLookupAddr;
  28.     ProcPtr        RegistryEntryIterateCreateAddr;
  29.     ProcPtr        RegistryEntryIterateDisposeAddr;
  30.     ProcPtr        RegistryEntryIterateSetAddr;
  31.     ProcPtr        RegistryEntryIterateAddr;    
  32.     ProcPtr        RegistryEntryIDDisposeAddr;    
  33.     ProcPtr        RegistryPropertyGetAddr;
  34.  
  35.     CFragConnectionID sCID;                    // our connection id to the name registry library
  36.  
  37.     Boolean        hasNameRegistry;            // does this cpu have a name registry
  38.     Boolean        checkedForNameRegistry;        // did we check for the name registry already
  39.  
  40.     short        numberOfPrinters;            // total number of printers listed (unused for now)
  41.     short        numberOfUSBPrinters;        // total number of USB printers
  42.     short        numberOfPorts;                // total number of serial ports (0-if we don't support serial)
  43.  
  44.     Boolean        supportsSerial;                // do we support serial
  45.     Boolean        supportsUSB;                // do we support USB
  46. // holds index into our STR# rsrc (name registry model path) for each entry in the printer list
  47.     short*        modelIndex;
  48. } USBGlobals, *USBGlobalsPtr, **USBGlobalsHandle;
  49.  
  50. typedef    struct
  51. {
  52.     unsigned short    branch;        // Branch instruction.
  53.     unsigned short    devID;        // Device ID.
  54.     OSType            resType;    // Resource type (always 'PACK').
  55.     short            resID;        // Resource ID (always -4096).
  56.     short            version;    // Printer driver version.
  57.     unsigned long    flags;        // Flag bits.
  58.     long int        storage;    // our storage
  59.     Str31            driverName;    // Name of printer driver.
  60.     char            code[1];    // PACK code starts here.
  61. } ChooserPACKHeader, *ChooserPACKHeaderPtr, **ChooserPACKHeaderHdl;
  62.                                         
  63. // description of the connection rsrc CTYP
  64. typedef struct
  65. {
  66.     short    selectedType;        // connection type of the selected printer
  67.     short    supportsSerial;        // do we support serial
  68.     short    supportsUSB;        // do we support USB
  69. } ConnectionType, *ConnectionTypePtr, **ConnectionTypeHdl;
  70.  
  71. extern    OSErr    InitGlobalStorage(void);
  72. extern    void    RemoveGlobalStorage(void);
  73. extern    USBGlobalsHandle    GetGlobalStorage(void);
  74. extern    pascal OSErr Chooser(    short message, short caller, StringPtr objName,
  75.                         StringPtr zoneName, long p1, long p2    );
  76.  
  77. #endif
  78.